﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             xmlns:Chapters_Chapter18="clr-namespace:FSharp.Chapter18;assembly=FSharpLibrary"
             x:Class="Chapters.AutomationClientAPIExample"
             x:Name="UserControl"
             d:DesignWidth="640"
             d:DesignHeight="480"
             AutomationProperties.AutomationId="ID_AutomationClient">

    <DockPanel x:Name="LayoutRoot">
        <TextBox x:Name="ConsoleText"
                 Margin="0,0,0,8"
                 VerticalAlignment="Bottom"
                 Height="200"
                 DockPanel.Dock="Bottom"
                 TextWrapping="Wrap"
                 AcceptsReturn="True"
                 VerticalScrollBarVisibility="Visible"
                 HorizontalScrollBarVisibility="Hidden"
                 AutomationProperties.AutomationId="ID_ConsoleText" />
        <StackPanel VerticalAlignment="Top"
                    Height="47"
                    DockPanel.Dock="Bottom"
                    Orientation="Horizontal">
            <Button HorizontalAlignment="Left"
                    Margin="8,0,0,0"
                    Content="Locate Elements"
                    VerticalAlignment="Center"
                    AutomationProperties.Name="Locate Elements"
                    Click="LocateElements" />
            <Button HorizontalAlignment="Left"
                    Margin="8,0,0,0"
                    Content="Find ScrollPattern"
                    VerticalAlignment="Center"
                    AutomationProperties.Name="Find ScrollPattern"
                    Click="CheckForControlPattern" />
            <Button HorizontalAlignment="Left"
                    Margin="8,0,0,0"
                    Content="Read Properties"
                    VerticalAlignment="Center"
                    AutomationProperties.Name="Read Properties"
                    Click="ReadProperties" />
            <Button HorizontalAlignment="Left"
                    Margin="8,0,0,0"
                    Content="Listen to Events"
                    VerticalAlignment="Center"
                    AutomationProperties.Name="Subscribe to Events"
                    Click="SubscribeToRangeSelectorEvents" />
            <Button HorizontalAlignment="Left"
                    Margin="8,0,0,0"
                    Content="Unsubscribe from Events"
                    VerticalAlignment="Center"
                    AutomationProperties.Name="Unsubscribe from Events"
                    Click="UnsubscribeFromRangeSelectorEvents" />
            <Button HorizontalAlignment="Left"
                    Margin="8,0,0,0"
                    Content="Navigate Tree"
                    VerticalAlignment="Center"
                    AutomationProperties.Name="Navigate Tree"
                    Click="NavigateToAncestor" />
            <Button HorizontalAlignment="Left"
                    Margin="8,0,0,0"
                    Content="Invoke Operation"
                    VerticalAlignment="Center"
                    AutomationProperties.Name="Invoke Operation"
                    Click="PerformOperation" />
            <Button HorizontalAlignment="Left"
                    Margin="8,0,0,0"
                    Content="Invoke Operation on Window"
                    VerticalAlignment="Center"
                    AutomationProperties.Name="Invoke Operation on Window"
                    Click="PerformOperationOnWindow" />
        </StackPanel>
        <Grid>
            <Button VerticalAlignment="Top"
                    Height="27"
                    Content="Button-1"
                    AutomationProperties.Name="Button-1"
                    Width="79"
                    HorizontalAlignment="Left"
                    Margin="8,8,0,0" />
            <ListBox HorizontalAlignment="Left"
                     Margin="91,8,0,8"
                     Width="117"
                     IsSynchronizedWithCurrentItem="True">
                <TextBlock Text="This"
                           TextWrapping="Wrap"
                           FontWeight="Bold" />
                <TextBlock Text="is"
                           TextWrapping="Wrap"
                           FontWeight="Bold" />
                <TextBlock Text="a"
                           TextWrapping="Wrap"
                           FontWeight="Bold" />
                <TextBlock Text="ListBox"
                           TextWrapping="Wrap"
                           FontWeight="Bold" />
            </ListBox>
            <Chapters_Chapter18:RangeSelector VerticalAlignment="Top"
                                              Height="31"
                                              Maximum="100"
                                              RangeStart="25"
                                              RangeEnd="75"
                                              AutomationProperties.AutomationId="ID_RangeSelector"
                                              Margin="212,8,228,0" />
            <Button VerticalAlignment="Bottom"
                    Height="27"
                    Content="Invoke Button"
                    Width="79"
                    HorizontalAlignment="Left"
                    Margin="8,0,0,8"
                    AutomationProperties.AutomationId="ID_InvokeButton"
                    Click="InvokeOperationOnButton" />
        </Grid>
    </DockPanel>
</UserControl>